// components/dialog/dialog.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    title: {
      type: String,
      value: "dialog	header default title"
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    msg: "默认数据",
    a: 1,
    b: 2,
    datalist: [0, 1, 2, 3, 4, 5]
  },
  observers: {
    'a,b': function (numbera, numberb) {
      this.setData({
        sum: numbera + numberb
      })
    },
    'datalist[5]': function (arr5) {
      console.log(arr5);
    }
  },

  lifetimes: {
    ready() {
      console.log('dialog ready')
      setTimeout(() => {
        this.setData({
          a: 100,
          b: 200,
          'datalist[5]':500
        })
      }, 1000)
    },
    attached() {
      console.log('dialog attached.')
    }
  },

  pageLifetimes: {
    show() {
      console.log('page show')
    }
  },


  /**
   * 组件的方法列表
   */
  methods: {
    handleClick() {
      console.log(666)
    },
    sendData() {
      this.triggerEvent('countEvent', 10)
    }
  }
})